import { request } from '@/framework/utils/request-jdz';

export const backupList = (params) => {
  return request(
    {
      url: 'backup',
      method: 'get',
      params,
    },
    {
      isGetDataDirectly: false,
    },
  );
};

export const backupDelete = (id) => {
  return request(
    {
      url: `backup/${id}`,
      method: 'delete',
    },
    {
      isGetDataDirectly: false,
    },
  );
};

export const backupCreate = () => {
  return request(
    {
      url: 'backup/execute',
      method: 'post',
      timeout: 60000,
    },
    {
      isGetDataDirectly: false,
    },
  );
};

export const restoreById = (id) => {
  return request(
    {
      url: `backup/${id}/restore`,
      method: 'post',
    },
    {
      isGetDataDirectly: false,
    },
  );
};

export const backupDownload = (id) => {
  return request({
    url: `backup/${id}/download`,
    method: 'get',
    responseType: 'blob',
    timeout: 60000,
  });
};
